package com.su.service;

import com.rabbitmq.client.Channel;
import org.springframework.amqp.core.Message;
import org.springframework.amqp.rabbit.annotation.RabbitListener;
import org.springframework.amqp.support.AmqpHeaders;
import org.springframework.messaging.handler.annotation.Header;
import org.springframework.messaging.handler.annotation.Payload;
import org.springframework.messaging.handler.annotation.SendTo;
import org.springframework.stereotype.Service;

import java.io.IOException;

@Service
public class revicemqservice{

    @RabbitListener(queues = "java-queue")
    @SendTo
    public String recivemq(Message msg) {
        byte[] msgBody = msg.getBody();
        String s = new String(msgBody);
        System.out.println("消息获取完成===》"+s);
        return s;
    }



}
